package code.theMaze.saveAndLoad;

import listeners.SaveAndLoadScreenGenerator;
import listeners.newfilenamelistener;
import utilities.Workbench;
import android.app.Activity;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;

public class TheMazeSaveLoadScreen extends ScrollView {

	private Activity theMazeSaveLoadscreen;
	private LinearLayout layout1;
	private TextView title, saveinfo;
	private EditText projektname;
	private Button newProjectnameButon, save;
	private Workbench workbench;
	private TextView console2;

	public TheMazeSaveLoadScreen(Activity context) {
		super(context);

		this.theMazeSaveLoadscreen = context;

		this.workbench = (Workbench) context.getApplication();

		layout1 = new LinearLayout(this.theMazeSaveLoadscreen);
		layout1.setOrientation(LinearLayout.VERTICAL);
		addView(layout1);

		title = new TextView(this.theMazeSaveLoadscreen);
		title.setText("the new screen");
		this.layout1.addView(title);

		this.saveinfo = new TextView(this.theMazeSaveLoadscreen);
		this.saveinfo.setText("Plz enter new projectname");
		this.layout1.addView(saveinfo);

		this.projektname = new EditText(this.theMazeSaveLoadscreen);
		this.projektname.setText(workbench.getFilename());
		this.layout1.addView(this.projektname);
		this.workbench.setEditTextOfFilemame(projektname);

		this.newProjectnameButon = new Button(this.theMazeSaveLoadscreen);
		this.newProjectnameButon.setText("chanche filemame");
		this.newProjectnameButon.setOnClickListener(new newfilenamelistener(
				this.workbench, projektname));
		this.layout1.addView(this.newProjectnameButon);

		save = new Button(this.theMazeSaveLoadscreen);
		save.setText("save this");
		save
				.setOnClickListener(new SaveAndLoadScreenGenerator(workbench,
						save));
		layout1.addView(save);

		console2 = new TextView(this.theMazeSaveLoadscreen);
		workbench.setConsole(console2);
		console2.setText("console");
		layout1.addView(workbench.getConsole2());
	}

}
